//
//  NSString+LZRegex.m
//  laziz_Consumer
//
//  Created by xbn_iMac on 2017/3/28.
//  Copyright © 2017年 XBN. All rights reserved.
//

#import "NSString+LZRegex.h"

@implementation NSString (LZRegex)

- (BOOL)isValidateByRegex:(NSString *)regex {
    NSPredicate *pre = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",regex];
    return [pre evaluateWithObject:self];
}

//正则校验邮箱
- (BOOL)isEmailAddress {
    NSString *emailRegex = @"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
    NSPredicate *pre = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",emailRegex];
    return [pre evaluateWithObject:self];
}

@end
